from leetcode_test import ListNode


class Solution:
    def oddEvenList(self, head: ListNode) -> ListNode:
        root = head
        even = []
        while head:
            if not head.next:
                break
            even.append(head.next)
            head.next = head.next.next
            if head.next:
                head = head.next
            else:
                break
        print(even)
        # if not head:

        for i in even:
            head.next = ListNode(i.val)
            head = head.next
        return root


if __name__ == "__main__":
    head = ListNode.create([1])
    res = Solution().oddEvenList(head)
    print(res.get_value())
